package com.cy.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * <p>Description: [后台用户角色中间表]</p>
 * @author         [曹悦] 
 */
@Entity
@Table(name = "CY_BACK_BACKUSERROLE")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class BackUserRole {
	private Long id;
	private BackUser backUser;	//用户
	private BackRole role;		//角色
	
	@Id
	@SequenceGenerator(name = "CY_BACK_BACKUSERROLE_SEQ", sequenceName = "CY_BACK_BACKUSERROLE_SEQ",allocationSize=1,initialValue=1)
	@GeneratedValue(strategy = GenerationType.IDENTITY, generator = "CY_BACK_BACKUSERROLE_SEQ")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "backUser_id", nullable = false)
	public BackUser getBackUser() {
		return backUser;
	}
	public void setBackUser(BackUser backUser) {
		this.backUser = backUser;
	}
	
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "role_id", nullable = false)
	public BackRole getRole() {
		return role;
	}
	public void setRole(BackRole role) {
		this.role = role;
	}

	
	
}
